#ifndef __SEVEN_SEGMENT_DISPLAY_BLOCK_H__
#define __SEVEN_SEGMENT_DISPLAY_BLOCK_H__

#include "Block.hpp"

namespace PocketSurvival
{
    // 白色7段显示器
    class SevenSegmentDisplayBlock : public Block
    {
    public:
        static constexpr int32_t Index()
        {
            return 185;
        }
        virtual int32_t getIndex() override; 
        virtual const std::string &getBlockName() override;

        virtual void getCreativeValues(std::vector<int32_t> &blockVec) override;
        virtual void getDropValues(int32_t oldValue, int32_t newValue, int32_t toolLevel, std::vector<BlockDropValue> &dropValues) override;
    
        virtual BlockPlacementData getPlacementValue(ComponentMiner *componentMiner, int32_t value, const TerrainRaycastResult &raycastResult) override;
        virtual const std::vector<BoundingBox> &getCustomCollisionBoxes(int32_t value) override;

		static inline int32_t GetMountingFace(int32_t data);
		static inline int32_t SetMountingFace(int32_t data, int32_t face);
		static inline int32_t GetColor(int32_t data);
		static inline int32_t SetColor(int32_t data, int32_t color);
    };

	inline int32_t SevenSegmentDisplayBlock::GetMountingFace(int32_t data)
	{
		return data & 3;
	}

	inline int32_t SevenSegmentDisplayBlock::SetMountingFace(int32_t data, int32_t face)
	{
		return (data & -4) | (face & 3);
	}

	inline int32_t SevenSegmentDisplayBlock::GetColor(int32_t data)
	{
		return (data >> 3) & 7;
	}

	inline int32_t SevenSegmentDisplayBlock::SetColor(int32_t data, int32_t color)
	{
		return (data & -57) | ((color & 7) << 3);
	}

} // namespace PocketSurvival


#endif
